package com.ctyun.oos;

import com.ctyun.oos.cilent.OosClient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @Author：wk
 * @Create：2022/1/20/18:50
 * @Description：TODO
 * @Version：1.0
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class OssUploadImg {

    @Autowired
    private OosClient oosClient;

    @Test
    public void uploadImag9() throws FileNotFoundException {
        File file = new File("D:\\img\\img9");
        File [] files = file.listFiles();
        Long size = 0L;
        for (int i = 0; i < files.length; i++)
        {
            File file1 = files[i];
            InputStream fileContent = new FileInputStream(file1);
            String name = file1.getName();//根据后缀判断
            oosClient.uploadFile(fileContent,null,name);
            size++;
        }
        System.out.println("总共上传："+size);
    }

    @Test
    public void uploadImag6_2() throws FileNotFoundException {
        File file = new File("D:\\img\\img6-2");
        File [] files = file.listFiles();
        Long size = 0L;
        for (int i = 0; i < files.length; i++)
        {
            File file1 = files[i];
            InputStream fileContent = new FileInputStream(file1);
            String name = file1.getName();//根据后缀判断
            oosClient.uploadFile(fileContent,null,name);
            size++;
        }
        System.out.println("总共上传："+size);
    }

    @Test
    public void uploadImag7() throws FileNotFoundException {
        File file = new File("D:\\img\\img7");
        File [] files = file.listFiles();
        Long size = 0L;
        for (int i = 0; i < files.length; i++)
        {
            File file1 = files[i];
            InputStream fileContent = new FileInputStream(file1);
            String name = file1.getName();//根据后缀判断
            oosClient.uploadFile(fileContent,null,name);
            size++;
        }
        System.out.println("总共上传："+size);
    }

    @Test
    public void uploadImag7_2() throws FileNotFoundException {
        File file = new File("D:\\img\\img7-2");
        File [] files = file.listFiles();
        Long size = 0L;
        for (int i = 0; i < files.length; i++)
        {
            File file1 = files[i];
            InputStream fileContent = new FileInputStream(file1);
            String name = file1.getName();//根据后缀判断
            oosClient.uploadFile(fileContent,null,name);
            size++;
        }
        System.out.println("总共上传："+size);
    }

    @Test
    public void uploadImag8() throws FileNotFoundException {
        File file = new File("D:\\img\\img8");
        File [] files = file.listFiles();
        Long size = 0L;
        for (int i = 0; i < files.length; i++)
        {
            File file1 = files[i];
            InputStream fileContent = new FileInputStream(file1);
            String name = file1.getName();//根据后缀判断
            oosClient.uploadFile(fileContent,null,name);
            size++;
        }
        System.out.println("总共上传："+size);
    }


    @Test
    public void uploadImag8_2() throws FileNotFoundException {
        File file = new File("D:\\img\\img8-2");
        File [] files = file.listFiles();
        Long size = 0L;
        for (int i = 0; i < files.length; i++)
        {
            File file1 = files[i];
            InputStream fileContent = new FileInputStream(file1);
            String name = file1.getName();//根据后缀判断
            oosClient.uploadFile(fileContent,null,name);
            size++;
        }
        System.out.println("总共上传："+size);
    }


}
